import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:test_app/store/userStore.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

class userPage extends ConsumerWidget {
  const userPage({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final token = ref.watch(userProvider.select((s) => s.token));
    void changeStateToken() {
      ref.read(userProvider.notifier).updateToken("456");
    }

    return Scaffold(
      appBar: AppBar(title: Text("用户")),
      body: Center(
        child: Column(
          children: [
            Text(token),
            TDButton(
              text: '填充按钮',
              size: TDButtonSize.large,
              type: TDButtonType.fill,
              shape: TDButtonShape.rectangle,
              theme: TDButtonTheme.defaultTheme,
              onTap: () => changeStateToken(),
            ),
          ],
        ),
      ),
    );
  }
}
